package com.qrxs.os.data.viewmodel

import androidx.lifecycle.MutableLiveData
import com.base.core.BaseViewModelIml
import com.lib.base.data.xsos.UserEntity
import com.lib.base.utils.LogUtils
import com.qrxs.os.data.repository.LoginRepository

class LoginViewModel : BaseViewModelIml(LoginRepository) {

    var userData = MutableLiveData<UserEntity>()

    fun login(
        loginName: String,
        password: String,
        equName: String,
        loginIp: String,
        equVersion: String,
        equImei: String
    ) {
        LoginRepository.login(
            loginName,
            password,
            equName,
            loginIp,
            equVersion,
            equImei
        ).subscribe({
            userData.postValue(it)
        }, {

            //模拟数据
            userData.postValue(UserEntity("1001", "凹凸曼", "123456"))

            LogUtils.e(it.message!!)
        })
    }
}